package main

func sortColors(nums []int) {
	num0 := 0
	num1 := 0
	num2 := 0
	for _, v := range nums {
		switch v {
		case 0:
			num0++
		case 1:
			num1++
		case 2:
			num2++
		}
	}
	i := 0
	for j := 0; j < num0; j++ {
		nums[i] = 0
		i++
	}
	for j := 0; j < num1; j++ {
		nums[i] = 1
		i++
	}
	for j := 0; j < num2; j++ {
		nums[i] = 2
		i++
	}
}

func main() {
	arr := []int{2, 0, 2, 1, 1, 0}
	sortColors(arr)
	println(arr)
}
